package com.devops.admin.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.devops.admin.mapper.DOSProjectApplyAuthorizeMapper;
import com.devops.admin.model.*;
import com.devops.admin.po.DOSProjectAuthorizePo;
import com.devops.admin.service.DOSProjectApplyAuthorizeService;
import com.devops.admin.vo.DOSPageVo;
import com.devops.admin.vo.DOSProjectAuthorizeVo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassNem DOSProjectApplyAuthorizeServiceImpl
 * @Description TODO
 * @Author heyabo
 * @Date 2022/3/22 09:16
 * @Version 1.0
 **/
@Service
public class DOSProjectApplyAuthorizeServiceImpl extends ServiceImpl<DOSProjectApplyAuthorizeMapper, DOSProjectApplyAuthorize> implements DOSProjectApplyAuthorizeService {

    @Override
    public TableResult<DOSProjectAuthorizePo> getAuthorizeList(DOSProjectAuthorizeVo authorizeVo, DOSPageVo pageVo) {
        Page<DOSProjectAuthorizePo> page = new Page<>(pageVo.getPageNum(),pageVo.getPageSize());
        TableResult<DOSProjectAuthorizePo> tableResult = new TableResult<>();
        List<DOSProjectAuthorizePo> authorizeList = baseMapper.getAuthorizeList(page, authorizeVo);
        Pagination p = Pagination.builder().pageNum(page.getCurrent()).pageSize(page.getSize()).total(page.getTotal()).build();
        tableResult.setList(authorizeList);
        tableResult.setPagination(p);

        return tableResult;
    }
}
